﻿/****************************************************************
  Author:  Ievgenii Nazaruk, ievgenii.nazaruk@gmail.com 
 License:  Microsoft Public License (Ms-PL)
          ( http://www.opensource.org/licenses/ms-pl.html or
            http://www.microsoft.com/opensource/licenses.mspx )
*****************************************************************/

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Net;

namespace WebLayer
{
    public class LogoutPage: WebPage
    {
        public LoginToken LoginToken;

        public LogoutPage(LoginToken token):
            base("LogoutPage",GetActionPageUri("logout"))
        {
            this.LoginToken = token;    
        }

        protected override void OnRequest(HttpWebRequest request)
        {
            base.OnRequest(request);

            if(LoginToken.IsLoggedIn() == true)
            {
                request.CookieContainer = LoginToken.Cookies;
            }
        }

        protected override void OnResponse(HttpWebRequest request, HttpWebResponse response)
        {
            base.OnResponse(request, response);                        
        }
    }
}
